/**
 * Copyright (C) 2012 The SkyTvOS Project
 * <p/>
 * Version     Date           Author
 * ─────────────────────────────────────
 * 2014年12月25日         cassie
 */

package com.coocaa.launcher.pattern.normal.util;

import android.content.Context;

import com.coocaa.launcher.framework.launcherhost.view.AppItemView;
import com.coocaa.launcher.framework.manager.configdata.data.LauncherAppItemTableData.APP_ITEM_TYPE;
import com.coocaa.launcher.framework.manager.configdata.data.LauncherAppItemTableData.AppEntryData;
import com.coocaa.launcher.framework.manager.configdata.data.LauncherAppItemTableData.AppItemData;
import com.coocaa.launcher.framework.manager.configdata.data.LauncherAppItemTableData.AppShortCutData;
import com.coocaa.launcher.pattern.normal.item.AppEntry;
import com.coocaa.launcher.pattern.normal.item.AppShortcut;

public class ItemViewFactory {
    public static AppItemView createItemView(Context mContext, AppItemData data) {
        if (data == null)
            return null;
        AppItemView itemView = null;
        switch (APP_ITEM_TYPE.valueOf(data.getType())) {
            case APP_ENTRY_TYPE:
                AppEntry entry = new AppEntry(mContext);
                entry.update((AppEntryData) data);
                itemView = entry;
                break;
            case APP_FOLDER_TYPE:
                break;
            case APP_SHORTCUT_TYPE:
                AppShortcut shortcut = new AppShortcut(mContext);
                shortcut.update((AppShortCutData) data);
                itemView = shortcut;
                break;
            case APP_WIDGET_TYPE:
                break;
            default:
                break;
        }
        return itemView;
    }
}
